/**
 * Created with IntelliJ IDEA.
 * Description:
 * Date: 2023-05-11
 * Time: 7:25
 */
class Animal{
    public String name;
    public int age;
    static {
        System.out.println("Animal static()--静态代码块");
    }

    {
        System.out.println("Animal {}--实例代码块");
    }

    public Animal(){
        System.out.println("Animal()--不带参数的构造方法");
    }
    public Animal(String name,int age){
        this.name = name;
        this.age = age;
        System.out.println("Animal(String name,int age)带2个参数的构造方法！");
    }
    public void eat(){
        System.out.println(name + " 正在吃饭！");
    }
}
/*class Bird extends Animal{
    public Bird(){
        super();
    }
}*/
class Dog extends Animal{
    static {
        System.out.println("Dog static()--静态代码块");
    }

    {
        System.out.println("Dog {}--实例代码块");
    }
    /*public Dog(){
        super("二蛋",10);
    }*/
    public Dog(){
        //super("123",10);
        System.out.println("DOG()--不带参数的构造方法");
    }
    public Dog(String name,int age){
        super(name,age);
    }
    public void wangwang(){
        System.out.println(name + " wangwang叫!");
    }
}
class Cat extends Animal{
    public Cat(){
        super();
    }
    public int size;
    /*public Cat(){
        super("咪咪",11);
    }*/
    public Cat(String name,int age,int size){
        super(name,age);
        this.size = size;
    }
    public void miaomiao(){
        System.out.println(name+" miaomiao叫！");
    }
}
public class Test {
    public static void main(String[] args) {
        Dog dog = new Dog();
        System.out.println("===========");
        Dog dog2 = new Dog();
    }
    public static void main1(String[] args) {
        Dog dog = new Dog();
        dog.name="小黄";
        dog.eat();

        Cat cat = new Cat();
        cat.name = "小花";
        cat.eat();
    }
}
